<template>
	<view class="z">
		
		<view class="nr">
			<view class="rl">
				<view class="rq">{{showday[1]}}</view>
				<view class="xq">
					<view class="xq1">{{showday[2]}}</view>
					<view class="ys">{{showday[0]}}</view>
				</view>
				<view class="yqd">已成功签到{{num}}天</view>
			</view>
			<view class="qdb">
				<view class="qd" v-for="(item,index) in list" :key="index" @click="tishi()">
					<image :src="item.showtype" class="qdt"></image>
					<view class="qdts">{{item.title}}</view>
				</view>
			</view>
			<view class="db">
				<button class="bt" @click="qiandao()">确认签到    +{{partmoney}}</button>
			</view>
		</view>
		<Login></Login>
	</view>
</template>

<script>
	export default {
		data() {
			return {

				list:[],
				num:0,
				showday:[],
				isclick:true,
				partmoney:10

			}
		},
		onShow() {
			var token = uni.getStorageSync('token');
			if(!token){
				uni.showToast({
					title:'请登录',
					icon:'none'
				})
				this.$store.commit("showLogin")
				return false;
			}
			this.getlist();
		},
		methods: {
			tishi(){
				uni.showToast({
					title:'请点击按钮签到',
					icon:'error'
				})
			},
			getlist(){
				var that = this;
				that.$http('center/qiandaolist',{},function(res){
					that.list = res.data.list;
					that.num = res.data.num;
					that.showday = res.data.showday;
					that.partmoney = res.data.partmoney;
				})
			},
			qiandao(){
				var that = this;
				if(!that.isclick) return false;
				that.isclick = false;
				that.$http('center/qiandao',{},function(res){
					that.isclick = true;
					if(res.code===0){
						if(!res.data.isvip){
							
						}else{
							setTimeout(function(){
								location.reload();
							},1200)
						}
						
					}
					uni.showToast({
						title:res.msg,
						icon:res.code===0?'success':'none',
						success() {
							if(!res.data.isvip&&res.code===0){
								uni.showModal({
									title:'签到提示',
									content:res.data.msg,
									showCancel:false,
									success() {
										uni.navigateTo({
										
											url:"/pages/vipgoods/index"
								
										})
									}
								})
							}
						}
					})
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.z {
		width: 100%;
		margin-bottom: 150px;

		.top {
			width: 100%;
			height: 176rpx;
			background: linear-gradient(90deg, #FF4638 0%, #FF2F20 100%);

			.title {
				display: flex;
				padding-top: 106rpx;

				.fh {
					width: 16rpx;
					height: 32rpx;
					padding-top: 6rpx;
					margin-left: 42rpx;
				}

				.titlewz {
					font-size: 36rpx;
					color: #FFFFFF;
					font-weight: 400;
					margin-left: 282rpx;
				}
			}
		}

		.nr {
			width: 100%;
			padding-top: 44rpx;

			.rl {
				width: 100%;
				height: 92rpx;
				display: flex;

				.rq {
					width: 80rpx;
					height: 92rpx;
					margin-left: 60rpx;
					font-size: 72rpx;
					color: #333333;
					font-weight: 500;
					font-family: DINPro-Medium, DINPro;
				}

				.xq {
					margin-left: 32rpx;

					.xq1 {
						width: 90rpx;
						height: 40rpx;
						margin-top: 4rpx;
						color: #333333;
						font-size: 32rpx;
						font-weight: 500;
					}

					.ys {
						margin-top: 6rpx;
						width: 140rpx;
						height: 40rpx;
						font-size: 28rpx;
						color: #727272;
					}
				}

				.yqd {
					height: 92rpx;
					line-height: 92rpx;
					margin-left: 200rpx;
					color: #333333;
					font-size: 32rpx;
					font-weight: 500;
				}
			}

			.qdb {
				width: 756rpx;
				margin-top: 16rpx;
				display: flex;
				flex-wrap: wrap;
				flex-direction: row;

				.qd {
					width: 59px;
					height: 126rpx;
					margin-left: 32rpx;
					margin-top: 24rpx;
					text-align: center;

					.qdt {
						width: 100%;
						height: 68rpx;
					}

					.qdts {
						font-size: 24rpx;
						color: #727272;
						margin-top: 24rpx;
						font-weight: 500;
					}
				}
			}
		}

		.db {
			width: 100%;
			height: 175rpx;
			box-shadow: 0px -3px 3px 1px rgba(0, 0, 0, 0.0300);
			background-color: #fff;
			position: fixed;
			left: 0;
			bottom: 60px;

			.bt {
				font-size: 36rpx;
				color: #FFFFFF;
				width: 686rpx;
				height: 96rpx;
				margin-top: 28rpx;
				background: linear-gradient(193deg, #64AEFF 0%, #0079FF 100%);
			}
		}
	}
</style>
